package org.jeecg.modules.labourwork.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.modules.labourwork.entity.WorkVehicle;
import org.jeecg.modules.labourwork.service.WorkVehicleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import org.jeecg.common.api.vo.Result;

import javax.xml.ws.Service;

@RestController
@RequestMapping("")

public class WorkVehicleController {
    @Autowired
    private WorkVehicleService workVehicleService;

    @RequestMapping(value = "/list", method = RequestMethod.GET)
    public Result<IPage<WorkVehicle>> list(WorkVehicle workVehicle,
                                           @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                           @RequestParam(name = "pageSize", defaultValue = "1") Integer pageSize) {
        Result<IPage<WorkVehicle>> result = new Result<IPage<WorkVehicle>>();
        Page<WorkVehicle> page = new Page<>(pageNo, pageSize);
        IPage<WorkVehicle> iPage = workVehicleService.findWorkOrderAll(page,workVehicle);
        iPage.setTotal((long) workVehicleService.countServiceWork(workVehicle));
        result.setResult(iPage);
        return result;

    }

/*    @RestController
    @RequestMapping("")
    public class ServiceWorkOrderController {
        @Autowired
        private IServiceWorkOrderService iServiceWorkOrderService;

        @RequestMapping(value = "/list",method = RequestMethod.GET)
        public Result<IPage<ServiceWorkOrderVo>> list(ServiceWorkOrderVo serviceWorkOrderVo,
                                                      @RequestParam(name = "pageNo",defaultValue="1") Integer pageNo,
                                                      @RequestParam(name = "pageSize",defaultValue="1") Integer pageSize) {
            Result<IPage<ServiceWorkOrderVo>> result = new Result<IPage<ServiceWorkOrderVo>>();
            //分页类
            Page<ServiceWorkOrderVo> page = new Page<ServiceWorkOrderVo>(pageNo, pageSize);
            //获得查询结果
            IPage<ServiceWorkOrderVo> iPage = iServiceWorkOrderService.findServiceWork(page, serviceWorkOrderVo);
            iPage.setTotal((long) iServiceWorkOrderService.countServiceWork(serviceWorkOrderVo));
            result.setResult(iPage);
            return result;
        }*/
    }







